<template>
	<view class="app">
		<!-- <view class="content">
			流程说明
		</view>
		<view class="btn-bar">
			<u-button type="primary" size="medium" shape="square" @click="toPage('./form')">填写评级申请</u-button>
			<u-button type="primary" size="medium" shape="square" @click="toPage('./attachment')">上传附件</u-button>
		</view> -->
		<image class="bg" :src="bg" mode="widthFix"></image>
		<view class="main">
			<view class="title">申报流程</view>
			<view class="main-content">
				<u-icon name="checkmark-circle-fill" color="#39b367" size="300"></u-icon>
				<view class="text1"> 已申报 </view>
				<view class="text2"> 您已完成申报 </view>
			</view>
			<view class="" style="text-align: center;">
				<view class="" style="margin-top: 18px;"> 您还可以
					<u-button type="primary" size="mini" shape="square" @click="showDate = true"> 预约现场评定日期 </u-button>
				</view>
			</view>
			<view class="" style="text-align: center;" v-if="yuyuedate">
				您已预约 <text style="font-size:20px;font-weight:700;color:red;">{{yuyuedate}}</text> 进行现场评定
			</view>
			<u-calendar v-model="showDate" mode="date" :min-date="minDate" :max-date="maxDate"  @change="changeDate"></u-calendar>
			
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bg: 'https://mp-adf91af7-51bf-4e2e-abae-1ed51120ab92.cdn.bspapp.com/cloudstorage/ae731d01-ae8a-44aa-a8db-7513fde2b8c0.png',
				step: 1, // 从哪个页面传入的 1form，2attachment
				
				id: null,
				yuyuedate: null,
				showDate: false,
				minDate: vk.pubfn.timeFormat(new Date(), "yyyy-MM-dd"),
				maxDate: '2050-12-31', // 日历的最大可选日期
			}
		},
		onLoad(options) {
			this.initPage(options);
		},
		methods: {
			initPage(options = {}){
				this.step = options.step || this.step;
				
				this.id = uni.getStorageSync('companyId');
				this.yuyuedate = uni.getStorageSync('companyYuyue');
				uni.removeStorageSync('companyId');
				uni.removeStorageSync('companyYuyue');
				// console.log('id', this.id);
			},
			toPage(url) {
				vk.navigateTo(url)
			},
			// 更换日历
			changeDate(e) {
				this.yuyuedate = e.result
				this.submitForm();
			},
			submitForm() {
				let data = {
					id: this.id,
					yuyuedate: this.yuyuedate
				}
				// console.log('提交data', data);
				vk.callFunction({
					url: 'client/sakj/pub.lhfj.apply3',
					data
				})
				.then(res => {
					// console.log('预约res', res);
					vk.toast("预约成功，请等待工作人员受理", "none", () => {
						
					}); 
				})
				.catch(err => {
					console.log('提交err', err);
				})
			},
			// 拨打电话
			callPhone(tel) {
				if(tel) uni.makePhoneCall({
					phoneNumber: tel
				})
			},
		}
	}
</script>

<style>
	/* .btn-bar{
		margin-top: 10px;
		display: flex;
		justify-content: space-around;
	} */
	
	.app{
		position: relative;
		padding: 0;
	}
	.bg{
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		z-index: 10;
	}
	
	.main{
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		z-index: 20;
	}
	
	.title{
		margin: 18px 0;
		height: 60px;
		font-size: 1.8em;
		font-weight: 700;
		text-align: center;
		line-height: 60px;
		color: #fff;
		letter-spacing: 4px;
		text-decoration: underline;
	}
	
	.main-content{
		margin: auto;
		padding: 180rpx 0 200rpx;
		width: 90%;
		/* height: 50vh; */
		background-color: #fff;
		text-align: center;
		border: 2px solid #D1E0F8;
		border-radius: 10px;
		box-shadow: 0 0 1px 2px #D1E0F860;
	}
	
	.text1{
		height: 60px;
		line-height: 60px;
		color: #39b367;
		font-size: 1.2em;
		font-weight: 700;
	}
	
</style>
